const adminModel = require('./../../service/admin');

module.exports = {
  async index(ctx) {
    // ctx.body = '后端管理主页';
    await ctx.render('./admin/index.pug');
  },

  async addFile(ctx) {
    let rows = await adminModel.addFile(ctx.request);
    if (rows.affectedRows > 0) {
      info = {
        info: '操作成功',
        code: 200
      }
    } else {
      info = {
        info: '操作失败',
        code: 400
      }
    }
    ctx.body = info;
  }
}